[Select] Fix flaky opening mouseup timing - #49024
Conversation
The selected-item timer started inside the unselected timer's callback. The chain compounds setTimeout jitter past the 400ms window. Slow CI runners then miss the window and the WebKit test fails. Start both timers from the mousedown instead. Widen the test sleeps to give the timers real headroom. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013HgD6GEW3UxNRvC2abbTy9
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
silviuaavram
left a comment
There was a problem hiding this comment.
Why do we need both test change (timers increase) and a component change (starting the timers simultaneously)? Shouldn't only of them suffice?
Good question. Each of the changes targets a different problem. Moving the second timer out of the first timer-callback makes sure time-jitter from the runner is minimized. So previously it was Now increasing the sleep times are meant to counter the uncontrollable jitter. The previous settings gave the tests not enough headroom for this. That's why I increased them. Its a safty measure that could have been enough on its own. The component change is just the extra cautious addition. |
Fixes a flaky WebKit failure in
Select > pointer interactions > closes when the opening mouseup lands on the selected option after the selected-item delay.The problem
SelectInputstarts the selected-item timer inside the unselected timer's callback. The chain runs 200ms + 200ms. EachsetTimeoutadds its own jitter, so the real window drifts past 400ms on a loaded runner. The test slept 450ms, a 50ms margin. WebKit on CI misses that margin, the mouseup arrives whileallowSelectedMouseUpis stillfalse, and the menu never closes.The fix
SELECTED_MOUSE_UP_DELAY). The jitter no longer compounds, and the flat delay matches the existing code comments.Both timers were already cleared together in
clearSelectionTimers, so no cleanup path depended on the nesting.Test plan
pnpm test:browser Select -t "pointer interactions"passes in WebKit and Chromium (22 tests).pnpm test:unit Selectpasses in jsdom (407 tests).🤖 Generated with Claude Code
https://claude.ai/code/session_013HgD6GEW3UxNRvC2abbTy9